import React, { Component } from 'react';
import { DatePicker, List } from 'antd-mobile';
// import axios from 'axios';

const nowTimeStamp = Date.now();
const now = new Date(nowTimeStamp);
// GMT is not currently observed in the UK. So use UTC now.
const utcNow = new Date(now.getTime() + (now.getTimezoneOffset() * 60000));

// Make sure that in `time` mode, the maxDate and minDate are within one day.
let minDate = new Date(nowTimeStamp - 1e7);
const maxDate = new Date(nowTimeStamp + 1e7);
// console.log(minDate, maxDate);
if (minDate.getDate() !== maxDate.getDate()) {
  // set the minDate to the 0 of maxDate
  minDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
}

class SelectDate extends Component {
	constructor (props) {
		super (props)
		this.state = {
			date: now,
			time: now,
			utcDate: utcNow,
			dpValue: null,
			customChildValue: null,
			visible: false,
		}
	}
// 	componentDidMount () {
// 		console.log(this.props.bir)
// 		let username = localStorage.username
// 		axios.post('/users/personal',{username:username})
// 			.then((data) => {
// 				// console.log(data.data)
// 				let per = data.data
// 			  this.setState ({
// 					data: per[0].birthday
// 				})
// 			})
// 	}
  render() {
    return (
      <List className="date-picker-list" style={{ backgroundColor: 'white' }}>
        <DatePicker
          mode="date"
          title="Select Date"
          extra={this.props.bir}
          value={this.state.date}
          onChange={date => this.setState({ date })}
        >
          <List.Item arrow="horizontal">修改生日</List.Item>
        </DatePicker> 
      </List>
    );
  }
}

export default SelectDate;